Optimal. Leaf size=407 \[ -\frac{\tan (c+d x) \left (-a^2 b^2 (6 A-7 C)+9 a^3 b B-12 a^4 C-6 a b^3 B+b^4 (3 A+2 C)\right )}{3 b^4 d \left (a^2-b^2\right )}+\frac{\left (6 a^2 b B-8 a^3 C-2 a b^2 (2 A+C)+b^3 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 b^5 d}+\frac{2 a^2 \left (2 a^2 A b^2-5 a^2 b^2 C-3 a^3 b B+4 a^4 C+4 a b^3 B-3 A b^4\right ) \tanh ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{b^5 d (a-b)^{3/2} (a+b)^{3/2}}-\frac{\tan (c+d x) \sec ^3(c+d x) \left (A b^2-a (b B-a C)\right )}{b d \left (a^2-b^2\right ) (a+b \sec (c+d x))}+\frac{\tan (c+d x) \sec ^2(c+d x) \left (4 a^2 C-3 a b B+3 A b^2-b^2 C\right )}{3 b^2 d \left (a^2-b^2\right )}+\frac{\tan (c+d x) \sec (c+d x) \left (3 a^2 b B-4 a^3 C-2 a b^2 (A-C)-b^3 B\right )}{2 b^3 d \left (a^2-b^2\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 1.73952, antiderivative size = 407, normalized size of antiderivative = 1., number of steps used = 9, number of rules used = 9, integrand size = 41, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.22, Rules used = {4098, 4102, 4092, 4082, 3998, 3770, 3831, 2659, 208} \[ -\frac{\tan (c+d x) \left (-a^2 b^2 (6 A-7 C)+9 a^3 b B-12 a^4 C-6 a b^3 B+b^4 (3 A+2 C)\right )}{3 b^4 d \left (a^2-b^2\right )}+\frac{\left (6 a^2 b B-8 a^3 C-2 a b^2 (2 A+C)+b^3 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 b^5 d}+\frac{2 a^2 \left (2 a^2 A b^2-5 a^2 b^2 C-3 a^3 b B+4 a^4 C+4 a b^3 B-3 A b^4\right ) \tanh ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{b^5 d (a-b)^{3/2} (a+b)^{3/2}}-\frac{\tan (c+d x) \sec ^3(c+d x) \left (A b^2-a (b B-a C)\right )}{b d \left (a^2-b^2\right ) (a+b \sec (c+d x))}+\frac{\tan (c+d x) \sec ^2(c+d x) \left (4 a^2 C-3 a b B+3 A b^2-b^2 C\right )}{3 b^2 d \left (a^2-b^2\right )}+\frac{\tan (c+d x) \sec (c+d x) \left (3 a^2 b B-4 a^3 C-2 a b^2 (A-C)-b^3 B\right )}{2 b^3 d \left (a^2-b^2\right )} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 4098
Rule 4102
Rule 4092
Rule 4082
Rule 3998
Rule 3770
Rule 3831
Rule 2659
Rule 208
Rubi steps
\begin{align*} \int \frac{\sec ^4(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{(a+b \sec (c+d x))^2} \, dx &=-\frac{\left (A b^2-a (b B-a C)\right ) \sec ^3(c+d x) \tan (c+d x)}{b \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac{\int \frac{\sec ^3(c+d x) \left (3 \left (A b^2-a (b B-a C)\right )+b (b B-a (A+C)) \sec (c+d x)-\left (3 A b^2-3 a b B+4 a^2 C-b^2 C\right ) \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{b \left (a^2-b^2\right )}\\ &=\frac{\left (3 A b^2-3 a b B+4 a^2 C-b^2 C\right ) \sec ^2(c+d x) \tan (c+d x)}{3 b^2 \left (a^2-b^2\right ) d}-\frac{\left (A b^2-a (b B-a C)\right ) \sec ^3(c+d x) \tan (c+d x)}{b \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac{\int \frac{\sec ^2(c+d x) \left (-2 a \left (3 A b^2-3 a b B+4 a^2 C-b^2 C\right )+b \left (3 A b^2-3 a b B+a^2 C+2 b^2 C\right ) \sec (c+d x)-3 \left (3 a^2 b B-b^3 B-2 a b^2 (A-C)-4 a^3 C\right ) \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{3 b^2 \left (a^2-b^2\right )}\\ &=\frac{\left (3 a^2 b B-b^3 B-2 a b^2 (A-C)-4 a^3 C\right ) \sec (c+d x) \tan (c+d x)}{2 b^3 \left (a^2-b^2\right ) d}+\frac{\left (3 A b^2-3 a b B+4 a^2 C-b^2 C\right ) \sec ^2(c+d x) \tan (c+d x)}{3 b^2 \left (a^2-b^2\right ) d}-\frac{\left (A b^2-a (b B-a C)\right ) \sec ^3(c+d x) \tan (c+d x)}{b \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac{\int \frac{\sec (c+d x) \left (-3 a \left (3 a^2 b B-b^3 B-2 a b^2 (A-C)-4 a^3 C\right )+b \left (3 a^2 b B+3 b^3 B-4 a^3 C-2 a b^2 (3 A+C)\right ) \sec (c+d x)+2 \left (9 a^3 b B-6 a b^3 B-a^2 b^2 (6 A-7 C)-12 a^4 C+b^4 (3 A+2 C)\right ) \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{6 b^3 \left (a^2-b^2\right )}\\ &=-\frac{\left (9 a^3 b B-6 a b^3 B-a^2 b^2 (6 A-7 C)-12 a^4 C+b^4 (3 A+2 C)\right ) \tan (c+d x)}{3 b^4 \left (a^2-b^2\right ) d}+\frac{\left (3 a^2 b B-b^3 B-2 a b^2 (A-C)-4 a^3 C\right ) \sec (c+d x) \tan (c+d x)}{2 b^3 \left (a^2-b^2\right ) d}+\frac{\left (3 A b^2-3 a b B+4 a^2 C-b^2 C\right ) \sec ^2(c+d x) \tan (c+d x)}{3 b^2 \left (a^2-b^2\right ) d}-\frac{\left (A b^2-a (b B-a C)\right ) \sec ^3(c+d x) \tan (c+d x)}{b \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac{\int \frac{\sec (c+d x) \left (-3 a b \left (3 a^2 b B-b^3 B-2 a b^2 (A-C)-4 a^3 C\right )-3 \left (a^2-b^2\right ) \left (6 a^2 b B+b^3 B-8 a^3 C-2 a b^2 (2 A+C)\right ) \sec (c+d x)\right )}{a+b \sec (c+d x)} \, dx}{6 b^4 \left (a^2-b^2\right )}\\ &=-\frac{\left (9 a^3 b B-6 a b^3 B-a^2 b^2 (6 A-7 C)-12 a^4 C+b^4 (3 A+2 C)\right ) \tan (c+d x)}{3 b^4 \left (a^2-b^2\right ) d}+\frac{\left (3 a^2 b B-b^3 B-2 a b^2 (A-C)-4 a^3 C\right ) \sec (c+d x) \tan (c+d x)}{2 b^3 \left (a^2-b^2\right ) d}+\frac{\left (3 A b^2-3 a b B+4 a^2 C-b^2 C\right ) \sec ^2(c+d x) \tan (c+d x)}{3 b^2 \left (a^2-b^2\right ) d}-\frac{\left (A b^2-a (b B-a C)\right ) \sec ^3(c+d x) \tan (c+d x)}{b \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac{\left (a^2 \left (3 A b^4+3 a^3 b B-4 a b^3 B-a^2 b^2 (2 A-5 C)-4 a^4 C\right )\right ) \int \frac{\sec (c+d x)}{a+b \sec (c+d x)} \, dx}{b^5 \left (a^2-b^2\right )}+\frac{\left (6 a^2 b B+b^3 B-8 a^3 C-2 a b^2 (2 A+C)\right ) \int \sec (c+d x) \, dx}{2 b^5}\\ &=\frac{\left (6 a^2 b B+b^3 B-8 a^3 C-2 a b^2 (2 A+C)\right ) \tanh ^{-1}(\sin (c+d x))}{2 b^5 d}-\frac{\left (9 a^3 b B-6 a b^3 B-a^2 b^2 (6 A-7 C)-12 a^4 C+b^4 (3 A+2 C)\right ) \tan (c+d x)}{3 b^4 \left (a^2-b^2\right ) d}+\frac{\left (3 a^2 b B-b^3 B-2 a b^2 (A-C)-4 a^3 C\right ) \sec (c+d x) \tan (c+d x)}{2 b^3 \left (a^2-b^2\right ) d}+\frac{\left (3 A b^2-3 a b B+4 a^2 C-b^2 C\right ) \sec ^2(c+d x) \tan (c+d x)}{3 b^2 \left (a^2-b^2\right ) d}-\frac{\left (A b^2-a (b B-a C)\right ) \sec ^3(c+d x) \tan (c+d x)}{b \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac{\left (a^2 \left (3 A b^4+3 a^3 b B-4 a b^3 B-a^2 b^2 (2 A-5 C)-4 a^4 C\right )\right ) \int \frac{1}{1+\frac{a \cos (c+d x)}{b}} \, dx}{b^6 \left (a^2-b^2\right )}\\ &=\frac{\left (6 a^2 b B+b^3 B-8 a^3 C-2 a b^2 (2 A+C)\right ) \tanh ^{-1}(\sin (c+d x))}{2 b^5 d}-\frac{\left (9 a^3 b B-6 a b^3 B-a^2 b^2 (6 A-7 C)-12 a^4 C+b^4 (3 A+2 C)\right ) \tan (c+d x)}{3 b^4 \left (a^2-b^2\right ) d}+\frac{\left (3 a^2 b B-b^3 B-2 a b^2 (A-C)-4 a^3 C\right ) \sec (c+d x) \tan (c+d x)}{2 b^3 \left (a^2-b^2\right ) d}+\frac{\left (3 A b^2-3 a b B+4 a^2 C-b^2 C\right ) \sec ^2(c+d x) \tan (c+d x)}{3 b^2 \left (a^2-b^2\right ) d}-\frac{\left (A b^2-a (b B-a C)\right ) \sec ^3(c+d x) \tan (c+d x)}{b \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac{\left (2 a^2 \left (3 A b^4+3 a^3 b B-4 a b^3 B-a^2 b^2 (2 A-5 C)-4 a^4 C\right )\right ) \operatorname{Subst}\left (\int \frac{1}{1+\frac{a}{b}+\left (1-\frac{a}{b}\right ) x^2} \, dx,x,\tan \left (\frac{1}{2} (c+d x)\right )\right )}{b^6 \left (a^2-b^2\right ) d}\\ &=\frac{\left (6 a^2 b B+b^3 B-8 a^3 C-2 a b^2 (2 A+C)\right ) \tanh ^{-1}(\sin (c+d x))}{2 b^5 d}+\frac{2 a^2 \left (2 a^2 A b^2-3 A b^4-3 a^3 b B+4 a b^3 B+4 a^4 C-5 a^2 b^2 C\right ) \tanh ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{(a-b)^{3/2} b^5 (a+b)^{3/2} d}-\frac{\left (9 a^3 b B-6 a b^3 B-a^2 b^2 (6 A-7 C)-12 a^4 C+b^4 (3 A+2 C)\right ) \tan (c+d x)}{3 b^4 \left (a^2-b^2\right ) d}+\frac{\left (3 a^2 b B-b^3 B-2 a b^2 (A-C)-4 a^3 C\right ) \sec (c+d x) \tan (c+d x)}{2 b^3 \left (a^2-b^2\right ) d}+\frac{\left (3 A b^2-3 a b B+4 a^2 C-b^2 C\right ) \sec ^2(c+d x) \tan (c+d x)}{3 b^2 \left (a^2-b^2\right ) d}-\frac{\left (A b^2-a (b B-a C)\right ) \sec ^3(c+d x) \tan (c+d x)}{b \left (a^2-b^2\right ) d (a+b \sec (c+d x))}\\ \end{align*}
Mathematica [A] time = 3.81893, size = 605, normalized size = 1.49 \[ \frac{(a \cos (c+d x)+b) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \left (6 \left (-6 a^2 b B+8 a^3 C+2 a b^2 (2 A+C)-b^3 B\right ) (a \cos (c+d x)+b) \log \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sin \left (\frac{1}{2} (c+d x)\right )\right )+6 \left (6 a^2 b B-8 a^3 C-2 a b^2 (2 A+C)+b^3 B\right ) (a \cos (c+d x)+b) \log \left (\sin \left (\frac{1}{2} (c+d x)\right )+\cos \left (\frac{1}{2} (c+d x)\right )\right )-\frac{24 a^2 \left (a^2 b^2 (2 A-5 C)-3 a^3 b B+4 a^4 C+4 a b^3 B-3 A b^4\right ) (a \cos (c+d x)+b) \tanh ^{-1}\left (\frac{(b-a) \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a^2-b^2}}\right )}{\left (a^2-b^2\right )^{3/2}}+\frac{b \tan (c+d x) \sec ^2(c+d x) \left (\cos (c+d x) \left (a^3 b^2 (29 C-18 A)-24 a^2 b^3 B+27 a^4 b B-36 a^5 C+a b^4 (9 A-2 C)+6 b^5 B\right )+b \left (b^2-a^2\right ) \cos (2 (c+d x)) \left (12 a^2 C-9 a b B+6 A b^2+4 b^2 C\right )-6 a^3 A b^2 \cos (3 (c+d x))-6 a^2 A b^3-6 a^2 b^3 B \cos (3 (c+d x))+9 a^3 b^2 B+7 a^3 b^2 C \cos (3 (c+d x))+4 a^2 b^3 C+9 a^4 b B \cos (3 (c+d x))-12 a^4 b C-12 a^5 C \cos (3 (c+d x))+3 a A b^4 \cos (3 (c+d x))-9 a b^4 B+2 a b^4 C \cos (3 (c+d x))+6 A b^5+8 b^5 C\right )}{b^2-a^2}\right )}{6 b^5 d (a+b \sec (c+d x))^2 (A \cos (2 (c+d x))+A+2 B \cos (c+d x)+2 C)} \]
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.117, size = 1254, normalized size = 3.1 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\left (A + B \sec{\left (c + d x \right )} + C \sec ^{2}{\left (c + d x \right )}\right ) \sec ^{4}{\left (c + d x \right )}}{\left (a + b \sec{\left (c + d x \right )}\right )^{2}}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.4407, size = 846, normalized size = 2.08 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]